<?php
use client\HSocketClient;
use server\HSocketServer;

define('ROOTDIR', __DIR__);

if(file_exists(ROOTDIR. '/vendor/autoload.php' )){
    require ROOTDIR. '/vendor/autoload.php';
}else{
    throw new Exception('Vender Load Core Dont\' Find');
}

$argv = $_SERVER['argv'];

if(isset($argv[1]) && $argv[1] === 'server'){
    HSocketServer::acceptSocket();
}else{
    HSocketClient::createSocket();
}
echo 'run server complete!' . PHP_EOL;